import initialState from '../state';

function commontReducer(state = initialState.commont, action){
    switch(action.type){
        case 'SUBMIT_COMMONT_BIGIN':
            return Object.assign({},state,{
                commontText:action.data
            });
        case 'GET_COMMENT_SUCCESS':
            let commontList = state.commontList.list
            action.data.rows.map(item => {
                commontList.push(item);
            })
            return Object.assign({},state,{
                commontList:{
                    list:commontList,
                    pageNo: action.data.currentPageNumber
                }
            });
        case 'CHANGE_COMMENT_ID':
            return Object.assign({},state,{
                commontId:action.id
            });
        case 'EDIT_COMMONT_ORDER_ID':
            return Object.assign({},state,{
                goCommontId: action.id
            })
        default :
            return state;
    }
}

export default commontReducer;